<template>
<div class="rank-box">
  <dv-border-box-10 :color="['#00aeff', '#00AEFF']" :reverse="true">
  <div class="rank-list">
    <div class="title">{{title}}</div>
    <div class="rank-list-item" v-for="(item, index) in data" :key="index">
      <div class="rank-list-item-icon">
        <div class="rank-list-item-icon-text" :style="{ background: getColor(index + 1) }">{{ index + 1 }}</div>
      </div>
      <div class="rank-list-item-name">{{ item.name }}</div>
      <div class="rank-list-item-progress">
        <a-progress :strokeWidth="strokeWidth" :percent="item.percentage" status='normal'></a-progress>
      </div>
      <div class="rank-list-item-value">
        {{ item.value }}
      </div>
    </div>
  </div>  
  </dv-border-box-10>
</div>
</template>

<script>
export default {
  props: {
    data: {
      type: Array,
      default: () => {
        return []
      }
    },
    strokeWidth:{
      type: Number,
      default: 10
    },
    title:{
      type:String,
      default:'各路段收入排行TOP10'
    }
  },
  data () {
    return {

    }
  },
  methods: {
    getColor (index) {
      switch(index) {
      case 1:
        return 'linear-gradient(0deg, #FAAE1C, #F86828)'
      case 2:
        return 'linear-gradient(0deg, #EA3E6F, #EB3FE2)'
      case 3:
        return 'linear-gradient(0deg, #00D6E6, #0051D9)'
      default:
        return 'rgba(0, 228, 255, 0.6)'
      }
    }
  }
}
</script>

<style scoped lang="scss">
.rank-list{
  .title{
    font-size: 12rem;
    font-family: PingFang SC;
    font-weight: bold;
    color: #FFFFFF;
  }
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-direction: column;
  color: #fff;
  width: 100%;
  height: 100%;
  font-size: 10rem;
  &-item{
    width: 100%;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 8rem;
    margin: 4rem 0;
    &-icon{
      margin-right: 8rem;
      &-text{
        width: 18rem;
        height: 18rem;
        line-height: 18rem;
        border-radius: 9rem;
        text-align: center;
        background-color: red;
        font-size: 10rem;
      }
    }
    &-progress{
      flex: 1;
      margin: 0 8rem;
    }
    ::v-deep .ant-progress-bg {
      background-color: rgba($color: #000000, $alpha: 0);
      background: linear-gradient(to left,#3FFFEA,#007EFF);
    }
    ::v-deep .ant-progress-inner{
      background-color: rgba($color: #000000, $alpha: 0);
    }
    ::v-deep .el-progress-bar__innerText{
      display: none;
    }
  }
}
</style>
